package com.wc.alorithm_luogu.P5724;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/4/20 12:27
 * @description https://www.luogu.com.cn/problem/P5724
 * 求极差 / 最大跨度值
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int max = -1;
        int min = 1001;

        int num;
        while (n-- > 0) {
            num = sc.nextInt();
            max = Math.max(max, num);
            min = Math.min(min, num);
        }

        System.out.println(max - min);
    }
}
